package org.swift.mashup.engine.concurrency;

import org.swift.mashup.engine.concurrency.agenda.JobSet;
import org.swift.mashup.engine.concurrency.execution.RuleSet;

/**
 * Creates jobs to run locally.
 * 
 * @author Jon Roberts
 *
 */
public class LocalConcurrentContext extends ConcurrentContext {

	private final RuleSet ruleSet;
	
	public LocalConcurrentContext (String sessionId, RuleSet ruleSet, int numNodes) {
		this(sessionId, StaticConcurrentConfiguration.newConfiguration(numNodes), ruleSet);
	}
	
	public LocalConcurrentContext(String sessionID, ConcurrentConfiguration configuration, RuleSet ruleSet) {
		super(sessionID,configuration);	
		this.ruleSet = ruleSet;
	}
	
	@Override
	protected Runnable createJob(String processid,	String workingDirectory, 
			int startIndex, int interval) {
		return new JobSet(processid, this.getSessionID(), workingDirectory, 
			startIndex, interval, this.ruleSet);
	}
}
